{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>课程审核</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" name="userAdd" id="userAdd" >
                        <input type="hidden" name="id" value="{$info.id}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">课程标题：</label>
                            <div class="input-group col-sm-4">
                                <input id="classroom_title" type="text" class="form-control" name="classroom_title" value="{$info.classroom_title}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">缩略图：</label>
                            <div class="input-group col-sm-5">
                                <img id="img_data" height="100px" style="float:left;margin-left: 50px;margin-top: -10px;cursor:pointer;" src="{$info.classroom_img}" onclick='imgDisplay(this)'/>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">售价：</label>
                            <div class="input-group col-sm-4">
                                <input id="classroom_price" type="text" class="form-control" name="classroom_price" value="{$info.classroom_price}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">课程类型：</label>
                            <div class="input-group col-sm-4">
                                <input id="classroom_name" type="text" class="form-control" name="classroom_name" value="{$info.classroom_name}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="form-group">
                                <label class="col-sm-3 control-label cyanse" for="myEditor">课程介绍：</label>
                                <div class="input-group col-sm-9">
                                    <textarea name="content" style="width:90%" id="myEditor">{$info.classroom_content}</textarea>
                                </div>
                            </div>
                        </div>
                        <!--{if $info.classroom_status==1}-->
                        <!--<div class="hr-line-dashed"></div>-->
                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-3 control-label">审核结果：</label>-->
                            <!--<div class="layui-input-block">-->
                                <!--<label><input type="radio" name="classroom_status" value="2" id="allow" checked>通过&nbsp;</label>-->
                                <!--<label><input type="radio" name="classroom_status" value="3" id="reject" >驳回</label>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="hr-line-dashed"></div>-->
                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-3 control-label">驳回理由：</label>-->
                            <!--<div class="layui-input-block">-->
                                <!--<textarea name="classroom_false_reason" id="reason" cols="30" rows="10" disabled></textarea>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--{/if}-->


                        <!--{if $info.classroom_status==3}--><!--{/if}-->
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">审核结果：</label>
                            <div class="input-group col-sm-4">
                                {if $info.classroom_status==1}
                                <input type="text" name="mechanism_status" class="form-control" value="审核中"  disabled>&nbsp;
                                {/if}
                                {if $info.classroom_status==2}
                                <input type="text" name="mechanism_status" class="form-control" value="通过"  disabled>&nbsp;
                                {/if}
                                {if $info.classroom_status==3}
                                <input type="text" name="mechanism_status" class="form-control" value="驳回"  disabled>
                                {/if}
                            </div>
                        </div>
                        {if $info.classroom_status==3}
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">驳回理由：</label>
                            <div class="layui-input-block">
                                <textarea name="classroom_false_reason" id="" cols="30" rows="10" disabled>{$info.classroom_false_reason}</textarea>
                            </div>
                        </div>
                        {/if}
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <!--{if $info.classroom_status==1}-->
                                <!--<button class="btn btn-primary btsave" type="submit"><i class="fa fa-save"></i> 审核</button>&nbsp;&nbsp;&nbsp;-->
                                <!--{/if}-->
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
{include file="public/footer" /}

<script type="text/javascript" src="__JS__/Crop.js"></script>
<script type="text/javascript">
    wk.upload("{:url('Upload/upload')}",2);


    //百度富文本编辑器
    var editor = UE.getEditor('myEditor', {
        initialFrameHeight:450,
        autoHeight: false,
        autoHeightEnabled:false,
        autoFloatEnabled:false
    });

    $.validator.setDefaults({
        highlight: function(e) {
            $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
            $(e).closest(".form-control").css("color","#737373");
        },
        success: function(e) {
            // e.closest(".form-group").removeClass("has-error").addClass("has-success")
            $(e).closest(".form-group").removeClass("has-error");
        },
        errorElement: "span",
        errorPlacement: function(e, r) {
            e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
            if(r.is("#groupid")){
                e.appendTo(r.parent());
            }
        },
        errorClass: "help-block m-b-none",
        validClass: "help-block m-b-none"
    }), $().ready(function() {
        var e = "<i class='fa fa-times-circle'></i> ";
        $("#userAdd").validate({
            submitHandler: function(form) {
//                $('button').attr('disabled', 'disabled');
                $.ajax({
                    url: "{:url('classroomaudit')}",
                    type: "post",
                    dataType: "json",
                    data: $("#userAdd").serialize(),
                    success: function (data) {
                        if (data.code == 200) {
                            wk.success(data.msg,1,"{:url('Classroom/index')}");
                        } else {
                            $('button').removeAttr('disabled');
                            wk.error(data.msg,2,'');
                            return false;
                        }
                    }
                });
            },
        })
    });
    //审核通过、驳回
    $(document).on('click', '#allow', function(){
        $('#reason').attr('disabled',true);
        $("#reason").trigger("chosen:updated");
    })
    $(document).on('click', '#reject', function(){
        $('#reason').attr('disabled',false);
        $("#reason").trigger("chosen:updated");
    })


</script>
</body>
</html>